package StudentManage;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.TreeSet;

/**
@Auther: MFM
@Date: 2021/7/25 - 07 - 25 - 16:05 
@version: 1.0
*/

public class Test {



    public static void main(String[] args) {
        TreeSet<String> set =new TreeSet<>((str1,str2)->{
            //花色
            String[] split1 = str1.split("\\w");
            String[] split2 = str2.split("\\w");
            //点数
            String s1 = str1.substring(2);
            String s2 = str2.substring(2);
            String basicChar = "2345678910JQKA";
            String Color = "红桃黑桃梅花方片";
            if (basicChar.indexOf(s1)>basicChar.indexOf(s2)){
                return -1;
            }else if (basicChar.indexOf(s1)<basicChar.indexOf(s2)){
                return 1;
            }else {
                if (Color.indexOf(split1[0])>Color.indexOf(split2[0])){
                    return 1;
                }else if (Color.indexOf(split1[0])<Color.indexOf(split2[0])){
                    return -1;
                }else {
                    return 0;
                }
            }
        });
        set.add("红桃K");
        set.add("方片A");
        set.add("黑桃5");
        set.add("方片5");
        set.add("梅花3");
        System.out.println(set);
    }
}
